

#pragma once


#include "NAsyncWorkPtr.h"

class NAsyncWorkRequestQueue
{
	public:	
		void Put( NAsyncWorkPtr& in_AsyncWorkPtr );
		NAsyncWorkPtr Get( void );
		void Complete( const unsigned int in_SerialKey );
		void Retry( NAsyncWorkPtr& in_AsyncWorkPtr );
		bool	isOK( void ) const{ return m_bOK; }
		HANDLE	GetEventObj( void ) const{ return m_hSemaphore; }	

	public:
		explicit NAsyncWorkRequestQueue( void );
		virtual ~NAsyncWorkRequestQueue( void );

	private:
		typedef list< NAsyncWorkPtr > REQUESTQUEUE;
		REQUESTQUEUE	m_RequestQueue;	

		typedef list< unsigned __int64  > SERIALCHECKLIST;
		SERIALCHECKLIST  m_SeriallizeCheckList;

		unsigned int			m_GetFailCnt;
		HANDLE					m_hSemaphore;
		CRITICAL_SECTION		m_CS;
		bool					m_bOK;	
};


